<template>
  <div>
    <h3>核验记录查询</h3>
    <el-card>
      <div>
        <el-form ref="form" :model="queryForm" inline label-width="80px" label-position="top">
          <el-form-item label="备案主体名称" prop="">
            <el-input v-model="queryForm.bodyName" size="small" placeholder="请输入备案主体名称" clearable></el-input>
          </el-form-item>
          <el-form-item label="统一社会信用代码" prop="">
            <el-input v-model="queryForm.companyCode" size="small" placeholder="请输统一社会信用代码" clearable></el-input>
          </el-form-item>
          <el-form-item label="业务流水号" prop="">
            <el-input v-model="queryForm.serialID" size="small" placeholder="请输入业务流水号" clearable></el-input>
          </el-form-item>
          <el-form-item label="核验结果">
            <el-select v-model="queryForm.result" size="small" placeholder="请选择核验结果" clearable>
              <el-option label="一致" value="1"></el-option>
              <el-option label="不一致" value="2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="核验时间" prop="">
            <el-date-picker
              size="small"
              v-model="time"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              clearable
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item label="" style="padding-top: 24px">
            <el-button size="mini" type="primary" icon="el-icon-search">查询</el-button>
            <el-button size="mini" type="primary" plain icon="el-icon-refresh">重置</el-button>
          </el-form-item>
        </el-form>
        <el-table
          :data="tableDatas"
          style="width: 100%"
          border
          class="table-box"
          :header-cell-style="{ background: '#fff', color: '#333' }"
        >
          <el-table-column label="序号" width="100px">
            <template slot-scope="scope">
              {{ (queryForm.page - 1) * queryForm.size + scope.$index + 1 }}
            </template>
          </el-table-column>
          <el-table-column prop="" label="流程状态" width="100px" show-overflow-tooltip>
            <template slot-scope="{ row }">
              {{ row.result == '1' ? '完成' : '待核验' }}
            </template>
          </el-table-column>
          <el-table-column prop="serialID" label="业务流水号" width="140px" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="companyCode" label="统一社会信用代码" width="140px" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="bodyName" label="备案主体名称" min-width="140px" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="bodyType" label="备案主体类型" width="140px" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="result" label="核验结果" width="100px" show-overflow-tooltip>
            <template slot-scope="{ row }">
              {{ row.result == '1' ? '核验一致' : '核验不一致' }}
            </template>
          </el-table-column>
          <el-table-column prop="status" label="是否有效" width="100px" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="orgName" label="提交机构" width="100px" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="optUser" label="操作用户" width="100px" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="time" label="核验时间" width="160px" show-overflow-tooltip> </el-table-column>
          <el-table-column prop="prop" label="操作" width="180" fixed="right">
            <template slot-scope="{ row }">
              <el-button type="text" icon="el-icon-view" @click="viewDetail(row)">查看</el-button>
              <el-button type="text" icon="el-icon-upload2" @click="viewDiff(row)" v-if="row.result == '2'">差异报告</el-button>
              <!-- <el-button type="text" icon="el-icon-search" @click="viewBackups(row)" v-if="row.result == '2'">查询备案主体信息</el-button> -->
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="queryForm.page"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="queryForm.size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
          class="text-right mar-top-12"
        />
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'RecordSearch',

  data() {
    return {
      time: [],
      queryForm: {
        bodyName: '',
        companyCode: '',
        serialID: '',
        startTime: '',
        endTime: '',
        result: '',
        page: 1,
        size: 10,
      },
      total: 2,
      tableDatas: [
        {
          serialID: 'CHECK20250808001001',
          companyCode: '914301003388567',
          bodyName: '世瑞科技股份有限公司',
          bodyType: '合伙企业',
          result: '1',
          status: '是',
          orgName: '测试机构',
          optUser: '义务机构',
          time: '2025-05-05 10:30:30',
        },
        {
          serialID: 'CHECK2025050500000018',
          companyCode: '914301003388567',
          bodyName: '世瑞科技股份有限公司',
          bodyType: '合伙企业',
          result: '2',
          status: '是',
          orgName: '测试机构',
          optUser: '义务机构',
          time: '2025-05-05 10:30:30',
        },
      ],
    }
  },

  mounted() {
    sessionStorage.removeItem('visit')
    sessionStorage.removeItem('bodyFlag')
  },

  methods: {
    viewDetail(row) {
      // sessionStorage.setItem('verifyInfo', JSON.stringify(row))
      // this.$router.push('/infoVerification/detail')
      this.$router.push({
        path: '/infoVerification/detail',
        query: {
          flag: row.result == '1' ? 1 : 0,
        },
      })
    },
    viewDiff(rwo) {
      this.$router.push('/diffreport/upload')
    },
    viewBackups(row) {
      // this.$router.push({
      //   path: '/infoVerification/backups',
      //   query: {
      //     checked: this.checked ? '1' : '0',
      //   },
      // })
    },
    handleSizeChange(val) {},
    handleCurrentChange(val) {},
  },
}
</script>
<style lang="scss" scoped>
::v-deep .el-range-editor--small.el-input__inner,::v-deep .el-input--small .el-input__inner {
  width: 222px;
}
::v-deep .el-form-item__label {
  padding: 0;
  line-height: 24px;
}
::v-deep .el-form-item {
  margin-bottom: 0;
}
</style>